#!/bin/sh

ROOTDN=$1
PASSWORD=$2
USERSDN=$3
GROUPSDN=$4
HOST=$5

EGROUPWARE_DB_PASS=/var/lib/ebox/conf/ebox-egroupware.passwd

export EGW_CLI_PASSWORD=`cat $EGROUPWARE_DB_PASS`

cd /usr/share/egroupware/setup

./setup-cli.php --config default,ebox --account-auth ldap,ldap \
    --ldap-host $HOST \
    --ldap-root-dn $ROOTDN \
    --ldap-root-pw $PASSWORD \
    --ldap-context $USERSDN \
    --ldap-group-context $GROUPSDN

cd -
